
package cn.com.api.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import cn.com.api.entity.ApiT_order;
import cn.com.api.entity.ApiT_order_detail;
import cn.com.api.mapper.base.T_orderMapperBase;
import cn.com.util.PageInfo;

//DAO
public interface ApiT_orderMapper extends T_orderMapperBase {

	// 新增对象后返回记录ID
	public int T_orderInsertion(ApiT_order t_order);

	// 查找订单
	public List<ApiT_order> findOrderByMap(Map map);

	public ApiT_order getOrderByOrderNum(String orderNum);

	public List<ApiT_order> getOrdersByUserId(@Param(value = "userId") String userId,
			@Param(value = "status") String status, @Param(value = "from") int from, @Param(value = "to") int to);

	public void cancelOrder(Map<String, Object> map);

	public List<Map<String, Object>> getRelationByProduct(@Param(value = "list") List<String> list,
			@Param(value = "userId") String userId);

	public List<Map<String, Object>> getRelationByProduct(@Param(value = "list") List<String> list,
			@Param(value = "userId") String userId, @Param(value = "currDate") String currentDay,
			@Param(value = "currHour") String currentHour);

	public String getProductIdsByOrderNum(@Param(value = "orderNum") String orderNum,
			@Param(value = "list") List<String> productIds);

	public void updPlStatusByOrderNum(String orderNum);

	public void updateOrderEnable(String orderNum);

	public ApiT_order_detail findOrderDetailsByMap(Map<String, Object> map);

	public void updateDDStatusBySerialFlagNo(@Param(value = "serialFlagNo") String serialFlagNo,
			@Param(value = "ddStatus") String ddStatus);

	public List<String> getCardIdsBySerialFlagNo(final String serialFlagNo);

	public String getAllPayMoneyBySerialFlagNo(final String serialFlagNo);

	public void updateOrderDDstatusByOrderNum(@Param(value = "orderNum") final String orderNum,
			@Param(value = "status") final String status);

	public void updateRemindShipmentByOrderNum(@Param(value = "orderNum") String orderNum,
			@Param(value = "time") String time);

	// 特卖汇订单
	public List<Map<String, String>> selectByOrListPage(@Param("map") Map<String, Object> conditions,
			@Param("page") PageInfo pageInfo);

	public Map<String, Object> getOrderInfoByOrderNum(String orderNum);

	public ApiT_order getpartnerorderinfo(@Param(value = "partnerid") String partnerid);

	public List<Map<String, Object>> selectBackOrderListPage(@Param("map") Map<String, Object> conditions,
			@Param("page") PageInfo pageInfo);

	public List<ApiT_order> selectMyOrderListPage(@Param("map") Map<String, Object> map,
			@Param("page") PageInfo pageInfo);

	public List<ApiT_order> getOrdersListPage(@Param(value = "userId") String userId,
			@Param(value = "status") String status, @Param("page") PageInfo pageInfo);

	public void updateSendStatus(Map<String, Object> map);

	// 根据活动ID 查询订单数量
	@Select("select count(d.target_id)as discover_count from t_order r left join t_order_detail d on r.rid = d.did where d.target_id = #{discover_id} and r.ORDERTYPE = '8'")
	public int findT_orderCountByTargetId(Map<String, String> params);

	public void insertT_order_info(ApiT_order t_order);

}
